class DeleteHabtmNtWcAndAddWcidToNt < ActiveRecord::Migration
  #Warning! This will empty work_categories and note_types
  
  def self.up
    NoteType.delete_all
    WorkCategory.delete_all
    Request.delete_all
    drop_table :note_types_work_categories
    add_column :note_types, :work_category_id, :integer, :default => 0
    change_column :notes, :dvalue, :date
  end

  def self.down
    remove_column :note_types, :work_category_id
    create_table :note_types_work_categories, :id => false do |t|
      t.column :note_type_id, :integer, :null => false, :default => 0
      t.column :work_category_id, :integer, :null => false, :default => 0
    end
    change_column :notes, :dvalue, :datetime
  end
end
